package com.olive.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.olive.interceptor.SignInterceptor;

@Configuration
public class SignInterceptorConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(signInterceptor())
                .addPathPatterns("/openapi/**");//只拦截openapi前缀的接口
    }
    
	//交给spring管理 SignInterceptor bean 
	//不然下边 private OpenApiApplyMapper applyMapper;注入为null
    @Bean
    public SignInterceptor signInterceptor(){
        return new SignInterceptor();
    }

}
